namespace ghost
{
    /**胜利界面*/
    export class WinUI extends GameUIBase{
        public img:GYSprite;
        public commitBtn:GYSprite;
        constructor(){
            super();
            let s= this;
            s.width = GameManager.DESIGN_WIDTH;
            s.height = GameManager.DESIGN_HEIGHT;            
            s.img = SkinManager.createImage(s,0,0,Conf.scene + "pass.png");            
            s.commitBtn = new GYSprite;
            s.commitBtn.texture = Main.instance.getRes(Conf.scene + "commitBtn.png");
            s.addChild(s.commitBtn);
            s.commitBtn.on(Laya.Event.CLICK, s, ()=>{
                Main.instance.exit();
            });
            s.maskClkEnabled = false;
        }        
        public resize(): void {
            super.resize();
            let s = this;
            s.img.y = s._module.frameBound.y + (s._module.frameBound.height - s.img.height >> 1) - 200;
            s.commitBtn.x = s.width-s.img.width>>1;
            s.commitBtn.y = s.img.y + s.img.height + 20;
            s.commitBtn.x = s.width-s.commitBtn.width>>1;
        }
        public show(pr:GYSprite=null, mask:boolean=true, tween:boolean=true):void
        {
            super.show(pr, mask, tween);            
            SoundManager.instance.play(`${Conf.sound}win.mp3`, 0, 1,null,null,SoundData.BACKGROUND_SOUND);
               
        }        
        protected clkMask(e:Laya.Event):void
        {
            super.clkMask(e);
            Main.instance.exit();
        }
    }
}